package fm;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    public static void main(String[] args) {
        System.out.println("hello");
        Connection conn = null;
        try {
            Class.forName("org.postgresql.Driver").newInstance();
            System.out.println("postgresql JDBC Driver Registered!");
            conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/lbsmarketing",
                    "fox", "612345");
            // do sth
            conn.close();


        } catch (ClassNotFoundException e) {
        //Cannot register postgresql  driver
            // System.out.println("This is something you have not add in postgresql library to classpath!");
            e.printStackTrace();
        } catch (Exception ex) {
// handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ((SQLException) ex).getSQLState());
//System.out.println("VendorError: " + ex.getErrorCode());
        }

    }
}
